Skip to main content

Step 2 - Roslyn Code Generator

Generation of Biz, API Client, Controllers and View Model files using Roslyn Code Generator

  • Open Code Generator Project

  • Open Program class and provide path of your WSL project as InputPath in args[0] and OutputPath for generated code.

namespace CodeMigration // Note: actual namespace depends on the project name.
{
internal class Program
{
static void Main(string[] args)
{
args = new string[6];
args[0] = @"D:\CWF\Repos\IRRBB4\MAIN\Web\Business\IRRBB4WSL\"; //Input Path of SVC to be Migrated
args[1] = @"D:\CWF\RoslynGeneratedCode\IRRBB4\MigratedSVC\"; //Output Path for Biz Files
ProjLvlMigration projLvlMig = new ProjLvlMigration();
projLvlMig.ProjLvlSvcCodeMig(args[0], args[1]);


args[2] = @"D:\CWF\RoslynGeneratedCode\IRRBB4\GeneratedControllers\"; //Output Path for Controllers
args[3] = @"D:\CWF\RoslynGeneratedCode\IRRBB4\GeneratedCustomViewModel\"; //Output Path for View Model
projLvlMig.ProjLvlControllerGeneration(args[0], args[2], args[3]);

args[4] = @"D:\CWF\RoslynGeneratedCode\IRRBB4\GeneratedAPIClients\"; //Output Path for API Clients
projLvlMig.ProjLvlAPIClientGeneration(args[0], args[4]);
}
}
}
  • Note: You can provide input path folder by folder to avoid migration of Auth related services.

  • Open CommonConst class modify these keys as per your requirement.

    #CommonCostDetailsExample
    1PrefixForApiClientNamespaceNamespace of Presentation layer projectPL
    2ReqVmNamespaceNamespace of Generated custom view modelDTO
    3ReqBizNamespaceNamespace of Generated Biz filesCom.Surya.Biz
    4ReqControllerNamespaceNamespace of Generated controller filesCom.Surya.WebAPI
  • Run the Project